package top.shenluw.springdemo;

import org.slf4j.Logger;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

import static org.slf4j.LoggerFactory.getLogger;

/**
 * @author Shenluw
 * 创建日期：2019/1/21 12:09
 */
@Component
public class TestConsumer {
    private final static Logger log = getLogger(TestConsumer.class);

    @JmsListener(destination = "spring.test", containerFactory = "queueFactory")
    public void receiveMsg(String msg) {
        log.info("msg: {}", msg);
    }

    @JmsListener(destination = "spring.test.queue", containerFactory = "queueFactory")
    public void receiveQueueMsg(String msg) {
        log.info("queue msg: {}", msg);
    }

    @JmsListener(destination = "spring.test.topic", containerFactory = "topicFactory")
    public void receiveTopicMsg(String msg) {
        log.info("topic msg: {}", msg);
    }

    @JmsListener(destination = "spring.test.topic", containerFactory = "topicFactory")
    public void receiveTopic2Msg(String msg) {
        log.info("topic2 msg: {}", msg);
    }

}
